﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace FlyWeightPattern
{
    class Program
    {
        private static readonly string[] colors = { "Red", "Green", "Blue", "White", "Black" };

        static void Main(string[] args)
        {
            for (int i = 0; i < 20; ++i)
            {
                Circle circle = (Circle)ShapeFactory.GetCircle(GetRandomColor());
                circle.SetX(GetRandomX());
                circle.SetY(GetRandomY());
                circle.SetRadius(100);
                circle.Draw();
            }

            Console.ReadKey();
        }

        private static string GetRandomColor()
        {
            Random m = new Random(Guid.NewGuid().GetHashCode());
            return colors[(int)(m.NextDouble() * colors.Count())];
        }
        private static int GetRandomX()
        {
            Random m = new Random(Guid.NewGuid().GetHashCode());
            return (int)(m.NextDouble() * 100);
        }
        private static int GetRandomY()
        {
            Random m = new Random(Guid.NewGuid().GetHashCode());
            return (int)(m.NextDouble() * 100);
        }
    }
}
